package b.g.b.h;

import b.d.i;
import b.g.b.g;
import b.g.b.h.l.n;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;

/* compiled from: ConstraintAnchor */
public class c {
    public HashSet<c> a = null;
    public int b;
    public boolean c;
    public final d d;
    public final a e;
    public c f;
    public int g = 0;
    public int h = -1;
    public g i;

    /* compiled from: ConstraintAnchor */
    public enum a {
        NONE,
        LEFT,
        TOP,
        RIGHT,
        BOTTOM,
        BASELINE,
        CENTER,
        CENTER_X,
        CENTER_Y
    }

    public c(d dVar, a aVar) {
        this.d = dVar;
        this.e = aVar;
    }

    /* JADX WARNING: Removed duplicated region for block: B:44:0x0074 A:{RETURN} */
    /* JADX WARNING: Missing block: B:12:0x0022, code skipped:
            if (r6.d.y == false) goto L_0x0040;
     */
    /* JADX WARNING: Missing block: B:19:0x003c, code skipped:
            if (r4 != r10) goto L_0x003e;
     */
    /* JADX WARNING: Missing block: B:31:0x0056, code skipped:
            if (r4 != r10) goto L_0x0040;
     */
    /* JADX WARNING: Missing block: B:42:0x006f, code skipped:
            if (r4 != r2) goto L_0x0040;
     */
    public boolean a(b.g.b.h.c r7, int r8, int r9, boolean r10) {
        /*
        r6 = this;
        r0 = 1;
        if (r7 != 0) goto L_0x0007;
    L_0x0003:
        r6.h();
        return r0;
    L_0x0007:
        r1 = 0;
        if (r10 != 0) goto L_0x0075;
    L_0x000a:
        r10 = b.g.b.h.c.a.CENTER_Y;
        r2 = b.g.b.h.c.a.CENTER_X;
        r3 = b.g.b.h.c.a.BASELINE;
        r4 = r7.e;
        r5 = r6.e;
        if (r4 != r5) goto L_0x0025;
    L_0x0016:
        if (r5 != r3) goto L_0x003e;
    L_0x0018:
        r10 = r7.d;
        r10 = r10.y;
        if (r10 == 0) goto L_0x0040;
    L_0x001e:
        r10 = r6.d;
        r10 = r10.y;
        if (r10 != 0) goto L_0x003e;
    L_0x0024:
        goto L_0x0040;
    L_0x0025:
        r5 = r5.ordinal();
        switch(r5) {
            case 0: goto L_0x0040;
            case 1: goto L_0x005b;
            case 2: goto L_0x0042;
            case 3: goto L_0x005b;
            case 4: goto L_0x0042;
            case 5: goto L_0x0040;
            case 6: goto L_0x0038;
            case 7: goto L_0x0040;
            case 8: goto L_0x0040;
            default: goto L_0x002c;
        };
    L_0x002c:
        r7 = new java.lang.AssertionError;
        r8 = r6.e;
        r8 = r8.name();
        r7.<init>(r8);
        throw r7;
    L_0x0038:
        if (r4 == r3) goto L_0x0040;
    L_0x003a:
        if (r4 == r2) goto L_0x0040;
    L_0x003c:
        if (r4 == r10) goto L_0x0040;
    L_0x003e:
        r10 = 1;
        goto L_0x0072;
    L_0x0040:
        r10 = 0;
        goto L_0x0072;
    L_0x0042:
        r2 = b.g.b.h.c.a.TOP;
        if (r4 == r2) goto L_0x004d;
    L_0x0046:
        r2 = b.g.b.h.c.a.BOTTOM;
        if (r4 != r2) goto L_0x004b;
    L_0x004a:
        goto L_0x004d;
    L_0x004b:
        r2 = 0;
        goto L_0x004e;
    L_0x004d:
        r2 = 1;
    L_0x004e:
        r3 = r7.d;
        r3 = r3 instanceof b.g.b.h.f;
        if (r3 == 0) goto L_0x0059;
    L_0x0054:
        if (r2 != 0) goto L_0x003e;
    L_0x0056:
        if (r4 != r10) goto L_0x0040;
    L_0x0058:
        goto L_0x003e;
    L_0x0059:
        r10 = r2;
        goto L_0x0072;
    L_0x005b:
        r10 = b.g.b.h.c.a.LEFT;
        if (r4 == r10) goto L_0x0066;
    L_0x005f:
        r10 = b.g.b.h.c.a.RIGHT;
        if (r4 != r10) goto L_0x0064;
    L_0x0063:
        goto L_0x0066;
    L_0x0064:
        r10 = 0;
        goto L_0x0067;
    L_0x0066:
        r10 = 1;
    L_0x0067:
        r3 = r7.d;
        r3 = r3 instanceof b.g.b.h.f;
        if (r3 == 0) goto L_0x0072;
    L_0x006d:
        if (r10 != 0) goto L_0x003e;
    L_0x006f:
        if (r4 != r2) goto L_0x0040;
    L_0x0071:
        goto L_0x003e;
    L_0x0072:
        if (r10 != 0) goto L_0x0075;
    L_0x0074:
        return r1;
    L_0x0075:
        r6.f = r7;
        r10 = r7.a;
        if (r10 != 0) goto L_0x0082;
    L_0x007b:
        r10 = new java.util.HashSet;
        r10.<init>();
        r7.a = r10;
    L_0x0082:
        r7 = r6.f;
        r7 = r7.a;
        if (r7 == 0) goto L_0x008b;
    L_0x0088:
        r7.add(r6);
    L_0x008b:
        if (r8 <= 0) goto L_0x0090;
    L_0x008d:
        r6.g = r8;
        goto L_0x0092;
    L_0x0090:
        r6.g = r1;
    L_0x0092:
        r6.h = r9;
        return r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.g.b.h.c.a(b.g.b.h.c, int, int, boolean):boolean");
    }

    public void b(int i, ArrayList<n> arrayList, n nVar) {
        HashSet hashSet = this.a;
        if (hashSet != null) {
            Iterator it = hashSet.iterator();
            while (it.hasNext()) {
                i.b(((c) it.next()).d, i, arrayList, nVar);
            }
        }
    }

    public int c() {
        if (this.c) {
            return this.b;
        }
        return 0;
    }

    public int d() {
        if (this.d.c0 == 8) {
            return 0;
        }
        int i = this.h;
        if (i > -1) {
            c cVar = this.f;
            if (cVar != null && cVar.d.c0 == 8) {
                return i;
            }
        }
        return this.g;
    }

    public boolean e() {
        HashSet hashSet = this.a;
        if (hashSet == null) {
            return false;
        }
        Iterator it = hashSet.iterator();
        while (it.hasNext()) {
            c cVar = (c) it.next();
            switch (cVar.e.ordinal()) {
                case 0:
                case 5:
                case 6:
                case 7:
                case 8:
                    cVar = null;
                    break;
                case 1:
                    cVar = cVar.d.F;
                    break;
                case 2:
                    cVar = cVar.d.G;
                    break;
                case 3:
                    cVar = cVar.d.D;
                    break;
                case 4:
                    cVar = cVar.d.E;
                    break;
                default:
                    throw new AssertionError(cVar.e.name());
            }
            if (cVar.g()) {
                return true;
            }
        }
        return false;
    }

    public boolean f() {
        HashSet hashSet = this.a;
        boolean z = false;
        if (hashSet == null) {
            return false;
        }
        if (hashSet.size() > 0) {
            z = true;
        }
        return z;
    }

    public boolean g() {
        return this.f != null;
    }

    public void h() {
        c cVar = this.f;
        if (cVar != null) {
            HashSet hashSet = cVar.a;
            if (hashSet != null) {
                hashSet.remove(this);
                if (this.f.a.size() == 0) {
                    this.f.a = null;
                }
            }
        }
        this.a = null;
        this.f = null;
        this.g = 0;
        this.h = -1;
        this.c = false;
        this.b = 0;
    }

    public void i() {
        g gVar = this.i;
        if (gVar == null) {
            this.i = new g(b.g.b.g.a.UNRESTRICTED);
        } else {
            gVar.c();
        }
    }

    public void j(int i) {
        this.b = i;
        this.c = true;
    }

    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(this.d.d0);
        stringBuilder.append(":");
        stringBuilder.append(this.e.toString());
        return stringBuilder.toString();
    }
}
